package com.lyc.service.impl;

import com.lyc.beans.User;
import com.lyc.mapper.UserMapper;
import com.lyc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getUser() {
        return userMapper.getUser();
    }

    @Override
    public User getUserByAccount(String account) {
        return null;
    }

    //检查用户是否存在
    @Override
    public boolean checkUserByAccount(String account) {
        int i = userMapper.checkUserByAccount(account);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }

    //添加用户
    @Override
    public void addUser(User user) {
        userMapper.addUser(user);
    }

    //登陆判断
    @Override
    public boolean login(User user) {
        int i = userMapper.login(user);
        if(i>0){
            return true;
        }else {
            return false;
        }
    }
}
